export function formatHours (value) {
  if (!value) {
    return `00`
  }
  let hours = Math.floor(value / (1000 * 60 * 60))
  if (hours < 10 && hours > 0) {
    return '0' + hours
  } else if (hours > 10) {
    return hours
  } else {
    return '00'
  }
}

export function formatMinutes (value) {
  if (!value) {
    return `00`
  }
  let minutes = Math.floor((value % (1000 * 60 * 60)) / (1000 * 60))
  if (minutes < 10 && minutes > 0) {
    return '0' + minutes
  } else if (minutes > 10) {
    return minutes
  } else {
    return '00'
  }
}

export function formatSeconds (value) {
  if (!value) {
    return `00`
  }
  let seconds = Math.round((value % (1000 * 60)) / 1000)
  if (seconds < 10 && seconds > 0) {
    return '0' + seconds
  } else if (seconds > 10) {
    return seconds
  } else {
    return '00'
  }
}

export function formatTime (value) {
  let hours = Math.floor(value / (1000 * 60 * 60))
  let minutes = Math.floor((value % (1000 * 60 * 60)) / (1000 * 60))
  let seconds = Math.round((value % (1000 * 60)) / 1000)
  if (hours < 10 && hours > 0) {
    hours = '0' + hours
  }
  if (minutes < 10 && minutes > 0) {
    minutes = '0' + minutes
  }
  if (seconds < 10 && seconds > 0) {
    seconds = '0' + seconds
  }
  return hours + ':' + minutes + ':' + seconds
}